<?php
echo $this -> Html -> css(array('template.css'));
echo $this -> Form -> create('form1', array('name' => 'form1', 'type' => 'file'));
?>
<div class="viewbook_border"><input type="hidden" name="mode" id="mode"
	value="<?php if ($file == 2) {echo $file;} else { foreach ($template as $itemsImage) {echo $itemsImage['Template']['image'];}}?>">
<table class="table_Root">
	<tr class="tr_table">
		<td class="bg">
			<?php 
				echo $this -> Html -> image('side_1.png', 
						array('alt' => 'ホームページTOP画像', 'title' => 'ホームページTOP画像', 'style' => 'width: 100%;'))
			?>
		</td>
		<td class="bg_right"><?php
		foreach ($template as $items) {
			echo $this -> Html -> image('uploads/' . $items['Template']['image'], array('alt' => 'image', 'style' => 'width: 320px; margin-left: 0px; margin-top: 0px; margin-bottom: 15px; margin-right: 200px; float: left'));
		}
		echo "</br>";
		?> <tt> <input type='file' name='upload' id='upload' size="40"> <input
			type='submit' id='imageUpload' name='imageUpload' value='画像登録'>
		※画像登録をすると表示画像が更新されます。</tt></td>
	</tr>
	<tr class="tr_table">
		<td class="bg">
			<?php 
				echo $this -> Html -> image('side_2.png', 
						array('alt' => '診療科目', 'title' => '診療科目', 'style' => 'width: 100%;'))
			?>
		</td>
		<td class="bg_right">
		<div>
		<div id="body_preview_block" style="display: block;">
		  <a href="#" onclick="close_open('body_preview_block','body_preview_opener');return false;">プレビューは常にON（以下すべて）</a>
		<div id="ps_preview"
			style="overflow: auto; overflow-x: hidden; overflow-y: visible;"><?php
			foreach ($template as $itemName) {
				echo $itemName['Template']['title'];
			}
			?></div>
		</div>
		<div id="body_preview_opener" style="display: none;">
		<a href="#" onclick="close_open('body_preview_opener','body_preview_block');return false;">プレビューは常にOFF（以下すべて）</a><br>
		<br>
		</div>
		<textarea name="editNameTitile"
			onkeyup="storeCaret(this); ShowPreview(this,'ps_preview');"
			onmouseup="storeCaret(this); ShowPreview(this,'ps_preview');"
			onfocus="SetFocus(this);" "
                        wrap="soft"
			cols="80" rows="4" name="ps" class="edit-body"><?php
			foreach ($template as $itemName) {
				echo trim($itemName['Template']['title']);
			}
			?>
                        </textarea></div>
		</td>
	</tr>
	<tr class="tr_table">
		<td class="bg" nowrap="nowrap">
			<?php 
				echo $this -> Html -> image('side_3.png', 
						array('alt' => '医院紹介', 'title' => '医院紹介', 'style' => 'width: 100%;'))
			?>
		</td>
		<td class="bg_right">
		<div id="body_preview_block_content" style="display: block;">
		<a href="#" onclick="close_open('body_preview_block_content','body_preview_opener_content');return false;">プレビューは常にON（以下すべて）</a>
		<div id="ps_previewContent"
			style="overflow: auto; overflow-x: hidden; overflow-y: visible; margin-right: 30px;">
			<?php
			foreach ($template as $itemContent) {
				echo trim($itemName['Template']['content']);
			}
			?></div>
		</div>
		<div id="body_preview_opener_content" style="display: none;">
		<a href="#" onclick="close_open('body_preview_opener_content','body_preview_block_content');return false;">プレビューは常にOFF（以下すべて）</a><br>
		<br>
		</div>
		<textarea name="editNameContent"
			onkeyup="storeCaret(this); ShowPreview(this,'ps_previewContent');"
			onmouseup="storeCaret(this); ShowPreview(this,'ps_previewContent');"
			onfocus="SetFocus(this);" wrap="soft" cols="80" rows="8" name="ps"
			class="edit-body"><?php
			foreach ($template as $itemContent) {
				echo trim($itemName['Template']['content']);
			}
			?>
                    </textarea></td>
	</tr>
	<tr class="tr_table">
		<td class="bg">
			<?php 
				echo $this -> Html -> image('side_5.png', 
						array('alt' => 'アクセス', 'title' => 'アクセス', 'style' => 'width: 100%;'))
			?>
		</td>
		<td class="bg_right">
		<div id="body_preview_block_decription" style="display: block;"> 
		<a href="#" onclick="close_open('body_preview_block_decription','body_preview_opener_decription');return false;">プレビューは常にON（以下すべて）</a>
		<div id="ps_previewMap"
			style="overflow: auto; overflow-x: hidden; overflow-y: visible; text-align: left; width: 400px;">
			<?php
			foreach ($template as $itemDeciption) {
				echo $itemDeciption['Template']['decription'];
			}
			?></div>
		</div>
		<div id="body_preview_opener_decription" style="display: none;">
		<a href="#" onclick="close_open('body_preview_opener_decription','body_preview_block_decription');return false;">プレビューは常にOFF（以下すべて）</a><br>
		<br>
		</div>

		<textarea name="editNameMap"
			onkeyup="storeCaret(this); ShowPreview(this,'ps_previewMap');"
			onmouseup="storeCaret(this); ShowPreview(this,'ps_previewMap');"
			onfocus="SetFocus(this);" wrap="soft" cols="80" rows="10" name="ps"
			class="edit-body"><?php foreach ($template as $itemDeciption) {echo trim($itemDeciption['Template']['decription']);}?></textarea>
			</td>
	</tr>
	<tr>
		<td class="bg">
			<?php 
				echo $this -> Html -> image('side_6.png', 
						array('alt' => 'サイトタイトルメタタグ', 'title' => 'サイトタイトルメタタグ', 'style' => 'width: 100%;'))
			?>
		</td>
		<td class="bg_right">
		<div style="margin: 10px 20px;"><span>サイトタイトルを入力</span> <br>
		<input class="text_seo" type="text" id="siteTitle" name="siteTitle"
			value='<?php foreach ($template as $itemDeciption) {echo trim($itemDeciption['Template']['titleSeo']);}?>'>
		<br>
		<span>メタタグを入力</span> <br>
		<input class="text_seo" type="text" id="metatag" name="metatag"
			value='<?php foreach ($template as $itemDeciption1) {echo trim($itemDeciption1['Template']['metatagSeo']);}?>'>
		</div>
		</td>
	</tr>
</table>
</div>
<div class="div_button">
	<input class="btn_save_template" type="submit" name="update" value="" id="update">
</div>
<?php 
	if (isset($flagSaveSuccess)) {
		echo "<script>alert('正常に保存しました。');</script>";
	}
?>
